#ifndef _MQTTMESSAGE_HEAD_H
#define _MQTTMESSAGE_HEAD_H
#include <mosquitto.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <memory>

using namespace std;

class MQTTMessage
{
public:
	MQTTMessage(const mosquitto_message *msg);
	uint32_t size() const;
	void *   data() const;
	char *   topic() const;
	int      qos() const;
	~MQTTMessage();
	class Message
	{
	public:
		Message(const mosquitto_message *msg);
		~Message();
		uint32_t size() const;
		void *   data() const;
		char *   topic() const;
		int      qos() const;

	private:
		mosquitto_message message;
	};

private:
	// mosquitto_message message;
	//引用计算 智能指针
	shared_ptr<Message> m_msg;
};

#endif